package com.springboot.cloud.demos.producer.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springboot.cloud.demos.entity.po.VideoLesson;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface VideoLessonMapper extends BaseMapper<VideoLesson> {
    /**
     * 为了区别plus原来的查询select*的字段 ，自定义为dy
     *
     * @param
     * @return 多表关联查询
     */
    @Select("SELECT a.id,a.title,a.subtitle,a.cover,a.url,a.play_count as playCount,a.free,a.teacher_id,a.created_time as createdTime,b.avatar,b.name as teacherName FROM t_video_lesson a LEFT JOIN t_teacher b ON a.teacher_id = b.id where a.level_id=#{id}")
    List<Map<String, Object>> queryByLevel(String id);
}
